package com.lanou.musicproject.fragment;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.design.widget.TabLayout;
import android.support.v4.app.Fragment;
import android.support.v4.view.ViewPager;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.lanou.musicproject.R;
import com.lanou.musicproject.adapter.HomePageAdapter;

/**
 * Created by dllo on 15/10/27.
 * lidong
 * 推荐页布局
 */
public class HomePageFragment extends Fragment {
    private TabLayout recommend_tablayout;
    private ViewPager homeviewPager;
    private HomePageAdapter adapter;

    public ViewPager getViewPager() {
        return homeviewPager;
    }


    @Nullable
    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        View view = inflater.inflate(R.layout.recommend_fragment,null);
        recommend_tablayout = (TabLayout) view.findViewById(R.id.recommend_tablayout);
        homeviewPager = (ViewPager) view.findViewById(R.id.frag_viewPager);
        initView();
        return view ;
    }

    private void initView() {
        adapter = new HomePageAdapter(getFragmentManager());
        homeviewPager.setAdapter(adapter);
        recommend_tablayout.setupWithViewPager(homeviewPager);
    }
}
